home *** CD-ROM | disk | FTP | other *** search
- on updateActors
- global gActorList
- set x to 1
- repeat while count(gActorList) > 0
- update(getAt(gActorList, x))
- set x to x + 1
- if x > count(gActorList) then
- exit repeat
- end if
- end repeat
- end
-
- on hideActor actorToHide
- global gActorList, gHiddenActorList
- add(gHiddenActorList, actorToHide)
- deleteAt(gActorList, getPos(gActorList, actorToHide))
- end
-
- on clearActor actorToClear
- global gActorList
- set actorPos to getPos(gActorList, actorToClear)
- if actorPos <> 0 then
- deleteAt(gActorList, actorPos)
- end if
- end
-
- on clearHiddenActor actorToClear
- global gHiddenActorList
- set actorPos to getPos(gHiddenActorList, actorToClear)
- if actorPos <> 0 then
- deleteAt(gHiddenActorList, actorPos)
- end if
- end
-
- on showActor actorToShow
- global gActorList, gHiddenActorList
- add(gActorList, actorToShow)
- deleteAt(gHiddenActorList, getPos(gHiddenActorList, actorToShow))
- end
-
- on hideOtherActors actorToKeep
- global gActorList, gHiddenActorList
- set gHiddenActorList to []
- repeat while count(gActorList) > 1
- if getPos(gActorList, actorToKeep) = 1 then
- add(gHiddenActorList, getAt(gActorList, 2))
- deleteAt(gActorList, 2)
- next repeat
- end if
- add(gHiddenActorList, getAt(gActorList, 1))
- deleteAt(gActorList, 1)
- end repeat
- end
-
- on hideAllActors
- global gActorList, gHiddenActorList
- repeat with actor in gActorList
- add(gHiddenActorList, actor)
- end repeat
- set gActorList to []
- end
-
- on showAllActors
- global gActorList, gHiddenActorList
- repeat with actor in gHiddenActorList
- add(gActorList, actor)
- end repeat
- set gHiddenActorList to []
- end
-
- on clearAllActors
- global gActorList, gHiddenActorList, gRollAnimButton, gLoopButton
- set gActorList to []
- set gHiddenActorList to []
- set gRollAnimButton to EMPTY
- set gLoopButton to EMPTY
- end
-
- on animateSprite spriteNum, destPoint, speed
- set startx to the locH of sprite spriteNum
- set starty to the locV of sprite spriteNum
- set endx to getAt(destPoint, 1)
- set endy to getAt(destPoint, 2)
- if (startx = endx) and (starty = endy) then
- exit
- end if
- set dist to sqrt(power(endx - startx, 2) + power(endy - starty, 2))
- set stepNumber to dist / speed
- set deltaX to (endx - startx) / stepNumber
- set deltaY to (endy - starty) / stepNumber
- repeat with x = 1 to integer(stepNumber)
- set the locH of sprite spriteNum to startx + (x * deltaX)
- set the locV of sprite spriteNum to starty + (x * deltaY)
- updateStage()
- end repeat
- set the locH of sprite spriteNum to endx
- set the locV of sprite spriteNum to endy
- updateStage()
- end
-
- on shuffleList originalList
- set shuffledList to []
- repeat while count(originalList) > 0
- set index to random(count(originalList))
- add(shuffledList, getAt(originalList, index))
- deleteAt(originalList, index)
- end repeat
- return shuffledList
- end
-
- on getPropPos someList, someProp
- set propPos to 0
- repeat with x = 1 to count(someList)
- set propName to getPropAt(someList, x)
- if propName = someProp then
- set propPos to x
- exit repeat
- end if
- end repeat
- return propPos
- end
-
- on puppetAll
- repeat with x = 1 to 48
- puppetSprite(x, 1)
- end repeat
- end
-
- on unpuppetAll
- repeat with x = 1 to 48
- puppetSprite(x, 0)
- end repeat
- end
-
- on removeSprite channel
- global gPoint
- set the castNum of sprite channel to gPoint
- set the locH of sprite channel to 1000
- end
-
- on getBoundRect castNumber, bgChannel
- if bgChannel = 0 then
- set bgRect to rect(0, 0, the stageRight - the stageLeft, the stageBottom - the stageTop)
- else
- set bgRect to the rect of sprite bgChannel
- end if
- set bmapReg to the regPoint of cast castNumber
- set bmapRect to the rect of cast castNumber
- set left to getAt(bmapReg, 1) - getAt(bmapRect, 1)
- set top to getAt(bmapReg, 2) - getAt(bmapRect, 2)
- set right to getAt(bmapRect, 3) - getAt(bmapReg, 1)
- set bottom to getAt(bmapRect, 4) - getAt(bmapReg, 2)
- set boundRect to rect(getAt(bgRect, 1) + left, getAt(bgRect, 2) + top, getAt(bgRect, 3) - right, getAt(bgRect, 4) - bottom)
- return boundRect
- end
-
- on getKernValue castNumber
- set bmapReg to the regPoint of cast castNumber
- set bmapRect to the rect of cast castNumber
- set kernValue to getAt(bmapRect, 3) - getAt(bmapReg, 1)
- set castName to the name of cast castNumber
- if getSuffix(castName) = "lower" then
- set kernValue to kernValue - 3
- else
- if getSuffix(castName) = "upper" then
- set kernValue to kernValue - 4
- end if
- end if
- return kernValue
- end
-
- on getSuffix stringData
- return char offset(".", stringData) + 1 to length(stringData) of stringData
- end
-
- on stripSuffix stringData
- return char 1 to offset(".", stringData) - 1 of stringData
- end
-
- on makePointList startChannel, howManyChannels
- set pointList to []
- repeat with channel = startChannel to startChannel + howManyChannels - 1
- add(pointList, point(the locH of sprite channel, the locV of sprite channel))
- end repeat
- return pointList
- end
-
- on startBuffering
- global gFlushObject, gCPU
- if gCPU = #Windows then
- gFlushObject(mBufferEvents)
- end if
- end
-
- on flushBuffer
- global gFlushObject, gCPU
- if gCPU = #Mac then
- gFlushObject(mFlush)
- else
- gFlushObject(mFlushEvents)
- end if
- end
-
- on paletteFix
- global gFixpal, gCPU
- if gCPU = #Mac then
- gFixpal(mPatchIt)
- end if
- end
-
- on printBitmap whichCast
- global gCPU, gXobjPath
- if gCPU = #Mac then
- set XObjFile to "pmatic.xobj"
- else
- set XObjFile to "pmatic.dll"
- end if
- openXLib(gXobjPath & XObjFile)
- set printerObject to PrintOMatic(mnew)
- if not objectp(printerObject) then
- alert("There is no currently selected printer. Printing features are disabled.")
- else
- printerObject(mRegister, "PMAT130-235-01341")
- set w to the width of cast whichCast
- set h to the height of cast whichCast
- printerObject(mSetLandscapeMode, 1)
- set pw to printerObject(mGetPageWidth)
- set ph to printerObject(mGetPageHeight)
- set scaling to min(float(pw) / float(w), float(ph) / float(h))
- set scaling to min(scaling, 1.0)
- set w to integer(w * scaling)
- set h to integer(h * scaling)
- set left to (pw - w) / 2
- set top to (ph - h) / 2
- printerObject(mNewPage)
- printerObject(mPicture, the picture of cast whichCast, left, top, left + w, top + h)
- if printerObject(mDoJobSetup) = 1 then
- updateStage()
- printerObject(mPrint)
- end if
- printerObject(mdispose)
- end if
- closeXLib(gXobjPath & XObjFile)
- end
-
- on copyScreenRegion boundSprite
- global gCPU, gCopyObj, gSavePicHandle
- if objectp(gCopyObj) then
- gCopyObj(mdispose)
- end if
- set top to the top of sprite boundSprite
- set left to the left of sprite boundSprite
- set bottom to the bottom of sprite boundSprite
- set right to the right of sprite boundSprite
- if gCPU = #Mac then
- set gCopyObj to StageToCast(mnew, top, left, bottom, right)
- set gSavePicHandle to the picture of cast "LineArtTemp"
- set the picture of cast "LineArtTemp" to gCopyObj(mGetHandle)
- else
- set tempCast to the number of cast "LineArtTemp"
- set gCopyObj to ScreenCapture(mnew)
- gCopyObj(mCpyScrnToClipbrd, left, top, right, bottom)
- pasteClipBoardInto(cast tempCast)
- updateStage()
- set the name of cast tempCast to "LineArtTemp"
- end if
- end
-
- on resetCastMember
- global gCPU, gSavePicHandle
- if gCPU = #Mac then
- set the picture of cast "LineArtTemp" to gSavePicHandle
- else
- set the picture of cast "LineArtTemp" to the picture of cast "Point"
- end if
- end
-
- on createCDpath volumeName, diskIDfilePath
- global gCDpath
- if the machineType = 256 then
- repeat with i = 66 to 90
- set drive to numToChar(i)
- set fullPath to string(drive & ":\" & diskIDfilePath)
- set myFile to FileIO(mnew, "read", fullPath)
- if objectp(myFile) then
- myFile(mdispose)
- return drive & ":"
- exit
- end if
- end repeat
- return 0
- else
- set fullPath to volumeName & ":" & diskIDfilePath
- set myFile to FileIO(mnew, "read", fullPath)
- if objectp(myFile) then
- myFile(mdispose)
- return volumeName & ":"
- exit
- end if
- return 0
- end if
- end
-
- on min a, b
- if a < b then
- return a
- else
- return b
- end if
- end
-
- on playSound soundName
- puppetSound(soundName)
- updateStage()
- repeat while soundBusy(1)
- end repeat
- puppetSound(0)
- end
-
- on bugDelay
- startTimer()
- repeat while the timer < 200
- end repeat
- end
-